import React from 'react'
import { StaticRouter } from 'react-router-dom'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import { JssProvider } from 'react-jss'
import { Provider } from 'mobx-react'
import createGenerateClassName from 'material-ui/styles/createGenerateClassName'

import createStores from './stores/create_stores'
import RouterMap from '../client/routers/rotuer_map'

// import HelMet from 'react-helmet'
// import RootStyle from './styles'

const createApp = (stores, context, location, theme, registry, jss) => {
  jss.options.createGenerateClassName = createGenerateClassName;
  return (
    <Provider {...stores}>
      <StaticRouter context={context} location={location} >
        <JssProvider registry={registry} jss={jss} >
          <MuiThemeProvider theme={theme} sheetsManager={new Map()}>
            <RouterMap />
          </MuiThemeProvider>
        </JssProvider>
      </StaticRouter>
    </Provider>
  )
}
export default createApp

export {
  createStores
}
